<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> instanceof 可以检查一个对象是否为一个类的实例,对象 instanceof 构造函数</title>
</head>

<body>
    <script type="text/javascript">
        function Person() {}

        function Dog() {}
        var person1 = new Person();
        var dog1 = new Dog();
        console.log(person1 instanceof Person);
        console.log(dog1 instanceof Person);
        console.log(dog1 instanceof Object); // 所有的对象都是Object的后代
    </script>
</body>

</html>